/*
 * OptionElement.cpp
 *
 *  Created on: 2010-6-7
 *      Author: Guobc
 */

#include "OptionElement.h"
#include "TextNode.h"
using namespace HA;

string OptionElement::mIds[] = { "OPTION" , ""};
string OptionElement::mEnds[] = { "OPTION", "SELECT", "INPUT", "TEXTAREA",
		"FORM", "BODY", "HTML" , ""};

OptionElement::OptionElement() :
	HA::CommonElement() {

}

string OptionElement::getOptionText(){
	ASTNode* node;
	TextNode* textNode;
	ASTNodeList children = getChildren();
	int size = children.size();
	for(int i = 0; i < size; i++){
		node = children.item(i);
		textNode = dynamic_cast<TextNode*> (node);
		if(textNode != NULL){
			return textNode->getText();
		}
	}
	return "";
}
